package com.hangim.pce.common.caching.service.impl;

import com.hangim.pce.common.caching.CacheConstants;
import com.hangim.pce.common.caching.service.CacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;

/**
 * @see CacheService
 */
@Service
public class CacheServiceImpl implements CacheService {
    private final static Logger logger = LoggerFactory.getLogger(CacheServiceImpl.class);

    /**
     * @see CacheService#clearCache()
     */
    @Override
    @Caching(evict = {
            @CacheEvict(value = CacheConstants.ELEMENT_RULE_CACHE, allEntries = true, beforeInvocation = true),
    })
    public void clearCache() {
        logger.debug("clear all cache.");
    }

    /**
     * @see CacheService#clearElementCache()
     */
    @Override
    @CacheEvict(value = CacheConstants.ELEMENT_RULE_CACHE, allEntries = true, beforeInvocation = true)
    public void clearElementCache() {
        logger.debug("clear element cache.");
    }

}
